#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import java.util.Iterator;
import java.util.List;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.BindBean;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.SqlUpdate;
import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper;
import org.skife.jdbi.v2.sqlobject.mixins.Transactional;

/**
 *
 * @author Kent Yeh
 */
public interface Dao extends Transactional<Dao> {

    @SqlQuery("SELECT id,name from member where name= :name")
    @RegisterMapper(Member.MemberMapper.class)
    Member findByName(@Bind("name") String name);

    @SqlQuery("SELECT id,name from member")
    @RegisterMapper(Member.MemberMapper.class)
    Iterator<Member> findAllMembers();

    @SqlQuery("SELECT id,name from member")
    @RegisterMapper(Member.MemberMapper.class)
    List<Member> listAllMembers();

    @SqlUpdate("update member set name= :name where id= :id")
    int updateMemberName(@BindBean Member ecMember);

    void close();
}
